<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="utf-8">
	<title>css3炫酷登录页</title>
	<meta name="description" content="particles.js is a lightweight JavaScript library for creating particles.">
	<meta name="author" content="Vincent Garreau" />
	<meta name="viewport"
		content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">

	<link rel="stylesheet" href="/public/css/style.css">
	<link rel="stylesheet" type="text/css" href="/public/css/reset.css" />
</head>

<body>
	<form id='register_form'>

		<div id="particles-js">
			<div class="login">
				<div class="login-top">
					注册
				</div>
				<div class="login-center clearfix">
					<div class="login-center-img"><img src="/public/img/name.png" /></div>
					<div class="login-center-input">
						<input type="text" name="email" value="" placeholder="请输入您的邮箱" onfocus="this.placeholder=''"
							onblur="this.placeholder='请输入您的邮箱'" />
						<div class="login-center-input-text">邮箱</div>
					</div>
				</div>
				<div class="login-center clearfix">
					<div class="login-center-img"><img src="/public/img/nicheng.png" /></div>
					<div class="login-center-input">
						<input type="text" name="nickname" value="" placeholder="请输入您的昵称" onfocus="this.placeholder=''"
							onblur="this.placeholder='请输入您的昵称'" />
						<div class="login-center-input-text">昵称</div>
					</div>
				</div>
				<div class="login-center clearfix">
					<div class="login-center-img"><img src="/public/img/password.png" /></div>
					<div class="login-center-input">
						<input type="password" name="password" value="" placeholder="请输入您的密码"
							onfocus="this.placeholder=''" onblur="this.placeholder='请输入您的密码'" />
						<div class="login-center-input-text">密码</div>
					</div>
				</div>
				<button type="submit" class="login-button">注册</button>

				<div class="message">
					<p>已有账号? <a href="/login" style="color:#0A3373">直接登录</a>.</p>
				</div>
			</div>
			<div class="sk-rotating-plane"></div>
		</div>

	</form>


	<!-- scripts -->
	<script src="/node_modules/jquery/dist/jquery.js"></script>
	<script src="/public/js/particles.min.js"></script>
	<script src="/public/js/app1.js"></script>
	<script type="text/javascript">
		$('#register_form').on('submit', function (e) {
			e.preventDefault()
			var formData=$(this).serialize()
			$.ajax({
				url:'/register',
				type:'post',
				data:formData,
				dataType:'json',
				success:function (data) {
					if(data.err_code==500){
						 return window.alert(data.message)
					}
					if(data.err_code==1){
						 return window.alert(data.message)
					}
					if(data.err_code==0){
						  window.alert(data.message)
						  window.location.href='/'
					}
				  }
			})
		})

	</script>
</body>

</html>